curl --location 'https://api.weya.live/backend/api/call/add-phone' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"integration": "plivo",
"phoneNumber": "+12125551234",
"accSId": "YOUR_AUTH_ID",
"authToken": "YOUR_AUTH_TOKEN"
}'
curl --location 'https://api.weya.live/backend/api/call/add-phone' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"integration": "sip",
"sipHost": "sip.example.com",
"sipUsername": "trunk-user",
"sipSecret": "YOUR_SIP_PASSWORD",
"sipPort": 5060,
"sipTransport": "udp"
}'
{
"status": true,
"code": 201,
"message": "Phone number added successfully",
"errorMessage": null,
"data": {
"_id": "64e5f12345abcdef87654321",
"userId": "64e5f12345abcdef12345678",
"phoneNumber": "+12125551234",
"integration": "plivo",
"createdAt": "2025-05-15T10:30:00.000Z"
}
}
Phone Numbers
Add Phone Number
Connect a phone number or SIP trunk from your telephony provider.
POST
/
api
/
call
/
add-phone
curl --location 'https://api.weya.live/backend/api/call/add-phone' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"integration": "plivo",
"phoneNumber": "+12125551234",
"accSId": "YOUR_AUTH_ID",
"authToken": "YOUR_AUTH_TOKEN"
}'
curl --location 'https://api.weya.live/backend/api/call/add-phone' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"integration": "sip",
"sipHost": "sip.example.com",
"sipUsername": "trunk-user",
"sipSecret": "YOUR_SIP_PASSWORD",
"sipPort": 5060,
"sipTransport": "udp"
}'
{
"status": true,
"code": 201,
"message": "Phone number added successfully",
"errorMessage": null,
"data": {
"_id": "64e5f12345abcdef87654321",
"userId": "64e5f12345abcdef12345678",
"phoneNumber": "+12125551234",
"integration": "plivo",
"createdAt": "2025-05-15T10:30:00.000Z"
}
}
Overview
Connect a phone number from your telephony provider so it can be used in campaigns and for inbound calls. The number is added for the user who owns the API key. For Plivo, Twilio, Vobiz and Telnyx, your credentials are checked with the provider before the number is saved, and the provider is set up to send call events to Weya. Elisiontec checks the API token only. SIP trunks are saved without a connection check. Supported providers:twilio, plivo, telnyx, vobiz, elisiontec and sip.
Prerequisites
- An API key for your workspace
- An account with the provider, and the number in that account
Request
Telephony provider:
twilio, plivo, telnyx, vobiz, elisiontec or sip. Not case-sensitive.Phone number with country code, for example
+12125551234. A missing + is added. Required for every provider except sip.Provider credential. Required for every provider except
sip.- Plivo, Twilio, Vobiz: the Auth Token
- Telnyx: the API key
- Elisiontec: the API token
Account ID. Required for Plivo (Auth ID), Twilio (Account SID) and Vobiz (Auth ID). Not used for Telnyx.
SIP only, required: SIP username. A trunk with the same host and username can’t be added twice.
curl --location 'https://api.weya.live/backend/api/call/add-phone' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"integration": "plivo",
"phoneNumber": "+12125551234",
"accSId": "YOUR_AUTH_ID",
"authToken": "YOUR_AUTH_TOKEN"
}'
curl --location 'https://api.weya.live/backend/api/call/add-phone' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"integration": "sip",
"sipHost": "sip.example.com",
"sipUsername": "trunk-user",
"sipSecret": "YOUR_SIP_PASSWORD",
"sipPort": 5060,
"sipTransport": "udp"
}'
Response
{
"status": true,
"code": 201,
"message": "Phone number added successfully",
"errorMessage": null,
"data": {
"_id": "64e5f12345abcdef87654321",
"userId": "64e5f12345abcdef12345678",
"phoneNumber": "+12125551234",
"integration": "plivo",
"createdAt": "2025-05-15T10:30:00.000Z"
}
}
The saved phone number record. It also contains the credentials you sent, so don’t log the response.
Error Handling
Errors returnstatus: false, with the reason in errorMessage.
- 400 Bad Request
Unknown integration type: …–integrationis missing or not supported.Phone number is required,Auth token is required for telephony integrations, orTwilio, Plivo and Vobiz require accSId.Elisiontec API token is required,Elisiontec List ID is requiredorPhone Number (DID) is required.Phone number already exists for this user, orSIP trunk already exists for host … and username ….- Invalid credentials, for example
Invalid Plivo SID or Auth Token. Please check your credentials.For Twilio and Telnyx this also means the number isn’t in that account.
- 401 Unauthorized – Missing or invalid API key.
- 500 Internal Server Error – The credentials were valid but setting up call events with the provider failed, or another server error. A missing
sipHostorsipUsernamealso returns 500.
Numbers must be unique per user: the same number can’t be added twice by the same user.
Was this page helpful?

